using System;
using System.Diagnostics;
using System.IO;

namespace Sedge.Core.FileSystemWrap
{
	class FileInfoWrap : IFileInfoWrap
	{
		private readonly FileInfo _fileInfo;

		public FileInfoWrap(FileInfo fileInfo)
		{
			_fileInfo = fileInfo;
		}

		public long FileSize
		{
			get { return _fileInfo.Length; }
		}

		public string FileVersion
		{
			get
			{
				string result;
				try
				{
					FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(_fileInfo.FullName);
					result = versionInfo.FileVersion;
				}
				catch
				{
					result = String.Empty;
				}

				return result;
			}
		}
	}
}